package com.lzy.system.organization.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lzy.exception.BusException;
import com.lzy.system.organization.entity.SysNav;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 导航菜单 Mapper 接口
 * </p>
 *
 * @author lcc
 * @since 2023-12-05
 */
public interface SysNavMapper extends BaseMapper<SysNav> {

    @Select("select * from sys_nav nav where id in (select nav_id from sys_role_nav roleNav where role_id in (select RID from sys_user_role userRole where UID in (select id from sys_user where username=#{userId}))) order by nav.order_index,nav.id")
    public List<SysNav> getUserNav(@Param("userId") String userId) throws BusException;
}
